import React, { useReducer,useEffect } from "react";
import context from "@/context";
import ShowColors from "./ShowColors";
import ChangeColors from "./ChangeColors";
const { ColorContext } = context;
export default function Colors() {
    const [color, dispatch] = useReducer((state, actions) => {
        switch (actions.type) {
            case "SET":
                return actions.color;
            default:
                return state;
        }
    }, "cyan");
    useEffect(() => {
        console.log(this)
        return () => {
            console.log(this)
        }
    },[])
    return (
        <ColorContext.Provider value={{ color, dispatch }}>
            <ShowColors />
            <ChangeColors />
        </ColorContext.Provider>
    );
}
